<?xml version="1.0"?>
<!-- A sample job config that explicitly configures job running the way it is configured by default (if there is no explicit config). -->
<job_conf>
    <plugins>
        <plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
        <plugin id="condor" type="runner" load="galaxy.jobs.runners.condor:CondorJobRunner"/>
        <plugin id="slurm" type="runner" load="galaxy.jobs.runners.slurm:SlurmJobRunner">
            <param id="drmaa_library_path">/usr/lib/slurm-drmaa/lib/libdrmaa.so</param>
        </plugin>
        <plugin id="pulsar_rest" type="runner" load="galaxy.jobs.runners.pulsar:PulsarRESTJobRunner">
            <param id="transport">{{ GALAXY_PULSAR_TRANSPORT | default('curl') }}</param>
        </plugin>
        {% if GALAXY_JOB_RUNNER == 'pulsar_mq' -%}
        <plugin id="pulsar_mq" type="runner" load="galaxy.jobs.runners.pulsar:PulsarMQJobRunner">
            <param id="galaxy_url">{{ PULSAR_GALAXY_URL }}</param>
            <param id="amqp_url">{{ PULSAR_CONFIG_MESSAGE_QUEUE_URL}}</param>
            <param id="amqp_acknowledge">True</param>
            <param id="amqp_ack_republish_time">30</param>
            <param id="amqp_publish_retry">True</param>
        </plugin>
        {% endif -%}
        {% if GALAXY_JOB_RUNNER == 'k8s' -%}
        <plugin id="k8s" type="runner" load="galaxy.jobs.runners.kubernetes:KubernetesJobRunner">
          <param id="k8s_config_path">{{ GALAXY_KUBECONFIG }}</param>
          <param id="k8s_persistent_volume_claims">{{ GALAXY_K8S_PVC | default('galaxy-root:/galaxy,galaxy-database:/galaxy/database,galaxy-tool-deps:/tool_deps') }}</param>
        </plugin>
        {% endif -%}
    </plugins>
    <destinations default="{{ GALAXY_DEPENDENCY_RESOLUTION | default('conda') }}_{{ GALAXY_JOB_RUNNER | default('local') }}">
        <destination id="local" runner="local">
            <env file="/galaxy/.venv/bin/activate" />
        </destination>
        <destination id="{{ GALAXY_DEPENDENCY_RESOLUTION | default('conda') }}_{{ GALAXY_JOB_RUNNER | default('local') }}" runner="{{ GALAXY_JOB_RUNNER | default('local') }}">
            {% if GALAXY_DEPENDENCY_RESOLUTION == 'singularity' -%}
              <env file="/galaxy/.venv/bin/activate" />
              <env id="HOME">/home/galaxy</env>
              <param id="singularity_enabled">true</param>
              {% if GALAXY_JOB_RUNNER == 'local' -%}
                <param id="singularity_volumes">{{ EXPORT_DIR | regex_replace("^.", "") }}/$galaxy_root:$galaxy_root:ro,{{ EXPORT_DIR | regex_replace("^.", "") }}/$tool_directory:$tool_directory:ro,{{ EXPORT_DIR | regex_replace("^.", "") }}/$job_directory:$job_directory:rw,{{ EXPORT_DIR | regex_replace("^.", "") }}/$working_directory:$working_directory:rw,{{ EXPORT_DIR | regex_replace("^.", "") }}/$default_file_path:$default_file_path:rw</param>
              {% endif -%}
            {% elif GALAXY_DEPENDENCY_RESOLUTION == 'docker' -%}
              <param id="docker_enabled">true</param>
              <param id="docker_sudo">false</param>
              <param id="docker_set_user"></param>
              {% if GALAXY_JOB_RUNNER == 'local' -%}
                <param id="docker_volumes">{{ HOST_EXPORT_DIR }}/$galaxy_root:$galaxy_root:ro,{{ HOST_EXPORT_DIR }}/$tool_directory:$tool_directory:ro,{{ HOST_EXPORT_DIR }}/$job_directory:$job_directory:rw,{{ HOST_EXPORT_DIR }}/$working_directory:$working_directory:rw,{{ HOST_EXPORT_DIR }}/$default_file_path:$default_file_path:rw</param>
              {% endif -%}
            {% elif not GALAXY_JOB_RUNNER.startswith('pulsar') and GALAXY_JOB_RUNNER != 'k8s' -%}
              <env file="/galaxy/.venv/bin/activate" />
            {% endif -%}
            {% if GALAXY_JOB_RUNNER == 'pulsar_rest' -%}
              <param id="url">{{ GALAXY_PULSAR_URL }}</param>
              <param id="private_token">{{ PULSAR_CONFIG_PRIVATE_TOKEN }}</param>
              <param id="dependency_resolution">remote</param>
            {% endif -%}
            {% if GALAXY_JOB_RUNNER == 'pulsar_mq' -%}
              <param id="jobs_directory">{{ PULSAR_JOBS_DIRECTORY | default('/pulsar/files/staging/') }}</param>
            {% endif -%}
            {% if GALAXY_JOB_RUNNER == 'k8s' -%}
              <param id="docker_repo_default">{{ GALAXY_K8S_DOCKER_REPO_DEFAULT | default('docker.io') }}</param>
              {% if GALAXY_K8S_DOCKER_OWNER_DEFAULT -%}<param id="docker_owner_default">{{ GALAXY_K8S_DOCKER_OWNER_DEFAULT }}</param>{% endif -%}
              <param id="docker_image_default">{{ GALAXY_K8S_DOCKER_IMAGE_DEFAULT | default('ubuntu') }}</param>
              <param id="docker_tag_default">{{ GALAXY_K8S_DOCKER_TAG_DEFAULT | default('20.04') }}</param>
              <param id="docker_enabled">true</param>
            {% endif -%}
        </destination>
    </destinations>
    <tools>
        <tool id="upload1" destination="local" />
        <tool id="__SET_METADATA__" destination="local" />
    </tools>
</job_conf>
